home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap11 / howto01 / cciccinf.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-06-12  |  29.1 KB  |  809 lines

  1. unit Cciccinf;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Grids, Outline, CCWSock;
  8.  
  9. type
  10.   TCCICInfoDlg = class(TForm)
  11.     Panel1: TPanel;
  12.     BitBtn1: TBitBtn;
  13.     BitBtn2: TBitBtn;
  14.     Panel4: TPanel;
  15.     ListBox2: TListBox;
  16.     Panel2: TPanel;
  17.     Edit1: TEdit;
  18.     Panel3: TPanel;
  19.     Edit2: TEdit;
  20.     Panel5: TPanel;
  21.     Edit3: TEdit;
  22.     Panel8: TPanel;
  23.     Edit4: TEdit;
  24.     Panel9: TPanel;
  25.     Edit5: TEdit;
  26.     Panel6: TPanel;
  27.     Label1: TLabel;
  28.     Label2: TLabel;
  29.     Button1: TButton;
  30.     Button2: TButton;
  31.     Button3: TButton;
  32.     Button4: TButton;
  33.     ListBox1: TListBox;
  34.     procedure Button1Click(Sender: TObject);
  35.     procedure ListBox2Click(Sender: TObject);
  36.     procedure BitBtn1Click(Sender: TObject);
  37.     procedure BitBtn2Click(Sender: TObject);
  38.     procedure Edit4Exit(Sender: TObject);
  39.     procedure Button2Click(Sender: TObject);
  40.     procedure Button3Click(Sender: TObject);
  41.     procedure Button4Click(Sender: TObject);
  42.     procedure ListBox1DblClick(Sender: TObject);
  43.   private
  44.     { Private declarations }
  45.   public
  46.     { Public declarations }
  47.   end;
  48.  
  49. var
  50.   CCICInfoDlg: TCCICInfoDlg;
  51. const
  52.   LBClickVector : Integer = 0;
  53.   ActiveMailbox : Integer = 0;
  54.  
  55. implementation
  56.  
  57. uses CCICCFrm;
  58.  
  59. {$R *.DFM}
  60. procedure TCCICInfoDlg.Button1Click(Sender: TObject);
  61. var TempSocket : TCCSocket; { Used for IP Address info }
  62.     DataBuffer : array[ 0 .. 256 ] of char;
  63. begin
  64.   case Tag of
  65.     1 : begin  { Get IP Address Mode }
  66.           { Create the dummy socket }
  67.           TempSocket := TCCSocket.Create( Self );
  68.           TempSocket.Parent := Self;
  69.           { Use it to get the info }
  70.           with TempSocket do
  71.           begin
  72.             { Move the IP address into the data buffer }
  73.             StrPCopy( DataBuffer , Edit1.Text );
  74.             { Turn it into a real IP address in binary form }
  75.             Socket_IP_Address.Socket_Address.Full_Internet_Address :=
  76.              inet_addr( DataBuffer );
  77.             { If not found then do remote lookup }
  78.             if Socket_IP_Address.Socket_Address.Full_Internet_Address = INADDR_NONE then
  79.             begin
  80.               { Call blocking function on IP name }
  81.               Socket_Host_Entry := gethostbyname( DataBuffer );
  82.               { If still no good then error out and exit }
  83.               if Socket_Host_Entry = nil then
  84.               begin
  85.                 Edit2.Text := 'Could Not Convert Host Name';
  86.                 Edit3.Text := '';
  87.               end
  88.               else
  89.               begin
  90.                 { Otherwise get the address }
  91.                 Socket_IP_Address.Socket_Address :=
  92.                  Socket_Host_Entry^.Host_Address^^;
  93.                 Edit2.Text :=
  94.                  IntToStr( Socket_IP_Address.Socket_Address.Net_Byte ) + '.' +
  95.                  IntToStr( Socket_IP_Address.Socket_Address.Host_Byte ) + '.' +
  96.                  IntToStr( Socket_IP_Address.Socket_Address.Local_Host_Byte ) +
  97.                  '.' + IntToStr(
  98.                  Socket_IP_Address.Socket_Address.Local_Machine_Byte );
  99.                 Edit3.Text :=
  100.                  IntToStr( Socket_IP_Address.Socket_Address.
  101.                             Full_Internet_Address );
  102.               end;
  103.             end;
  104.           end;
  105.           { Free the dummy socket }
  106.           TempSocket.Free;
  107.         end;
  108.     2 : begin { Anonymous login punch }
  109.           Edit3.Text := 'anonymous';
  110.           CurrentRealPWString := CurrentPassWordString;
  111.           case PasswordControlVector of
  112.             1 : Edit4.Text := CurrentPassWordString;
  113.             2 : Edit4.Text := '**********';
  114.           end;
  115.         end;
  116.     5 : begin { Toggle subscribe/unsubscribe status }
  117.           if Edit3.Text = 'Subscribed' then Edit3.Text := 'UnSubscribed' else
  118.            Edit3.Text := 'Subscribed';
  119.         end;
  120.   end;
  121. end;
  122.  
  123. procedure TCCICInfoDlg.ListBox2Click(Sender: TObject);
  124. var TheWorkingList  : TList;
  125.     Counter_1       : Integer;
  126.     WorkingMBRecord : PEMailMailboxRecord;
  127.     Finished        : Boolean;
  128. begin
  129.   { Use Tag vector to find out how to interpret a click }
  130.   case Tag of
  131.     2 : begin
  132.           { If nothing in list box then exit }
  133.           if ListBox2.ItemIndex = -1 then exit;
  134.           { Use the data in the Working FTP Site List TList }
  135.           with PConnectionsRecord(
  136.            TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  137.           begin
  138.               Edit1.Text := CProfile;
  139.               Edit2.Text := CIPAddress;
  140.               Edit3.Text := CUserName;
  141.               CurrentRealPWString := CPassword;
  142.               case PasswordControlVector of
  143.                 1 : Edit4.Text := CPassword;
  144.                 2 : Edit4.Text := '**********';
  145.               end;
  146.               Edit5.Text := CStartDir;
  147.           end;
  148.         end;
  149.     4 : begin
  150.           { If nothing in list box then exit }
  151.           if ListBox2.ItemIndex = -1 then exit;
  152.           { Use the data in the Working FTP Site List TList }
  153.           with PConnectionsRecord(
  154.            TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  155.           begin
  156.               Edit1.Text := CProfile;
  157.               Edit2.Text := CIPAddress;
  158.           end;
  159.         end;
  160.     5 : begin
  161.           { If nothing in list box then exit }
  162.           if ListBox2.ItemIndex = -1 then exit;
  163.           { Use the data in the Working FTP Site List TList }
  164.           with PNewsGroupRecord(
  165.            TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  166.           begin
  167.               Edit1.Text := GName;
  168.               Edit2.Text := GRealName;
  169.               if GSubScribed then Edit3.Text := 'Subscribed' else
  170.                Edit3.Text := 'UnSubscribed';
  171.           end;
  172.         end;
  173.     6 : begin
  174.           { If nothing in list box then exit }
  175.           if ListBox2.ItemIndex = -1 then exit;
  176.           { Use the data in the Working POPSMTP Site List TList }
  177.           with PConnectionsRecord(
  178.            TheWorkingEMSL.Items[ ListBox2.ItemIndex ] )^ do
  179.           begin
  180.               Edit1.Text := CProfile;
  181.               Edit2.Text := CIPAddress;
  182.               Edit3.Text := CUserName;
  183.               CurrentEMRealPWString := CPassword;
  184.               case EMPasswordControlVector of
  185.                 1 : Edit4.Text := CPassword;
  186.                 2 : Edit4.Text := '**********';
  187.               end;
  188.               Edit5.Text := CStartDir;
  189.           end;
  190.         end;
  191.   end;
  192. end;
  193.  
  194. { This procedure saves the newly modified list of stuff to its base }
  195. procedure TCCICInfoDlg.BitBtn1Click(Sender: TObject);
  196. var Counter_1  : Integer;            { Loop counter        }
  197.     ThePointer : PConnectionsRecord; { Generic TCR Pointer }
  198.     TheNGRecord : PNewsGroupRecord;
  199.     TheMBRecord : PEMailMailboxRecord;
  200. begin
  201.   { Use the tag vector to find out what to do }
  202.   case Tag of
  203.     2 : begin { Do FTP Site List }
  204.           { dispose the old FTP site list's pointers }
  205.           for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  206.           begin
  207.             Dispose( PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] ));
  208.           end;
  209.           { Clear the lists }
  210.           TheFTPSiteList.Clear;
  211.           CCInetCCForm.ComboBox1.Clear;
  212.           { Add the new info }
  213.           for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
  214.           begin
  215.             { Create a new pointer }
  216.             New( ThePointer );
  217.             { Move the data into it }
  218.             ThePointer^ :=
  219.              PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] )^;
  220.             { Add the item }
  221.             TheFTPSiteList.Add( ThePointer );
  222.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  223.              TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  224.           end;
  225.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  226.         end;
  227.     4 : begin { Do NNTP Site List }
  228.           { dispose the old FTP site list's pointers }
  229.           for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  230.           begin
  231.             Dispose( PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] ));
  232.           end;
  233.           { Clear the lists }
  234.           TheNewsServerList.Clear;
  235.           CCInetCCForm.ComboBox1.Clear;
  236.           { Add the new info }
  237.           for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
  238.           begin
  239.             { Create a new pointer }
  240.             New( ThePointer );
  241.             { Move the data into it }
  242.             ThePointer^ :=
  243.              PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] )^;
  244.             { Add the item }
  245.             TheNewsServerList.Add( ThePointer );
  246.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  247.              TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  248.           end;
  249.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  250.         end;
  251.     5 : begin { Do NNTP Newsgroups List }
  252.           { dispose the old NG list's pointers }
  253.           for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  254.           begin
  255.             Dispose( PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] ));
  256.           end;
  257.           { Clear the lists }
  258.           TheNewsRCList.Clear;
  259.           { Add the new info }
  260.           for Counter_1 := 0 to TheWorkingNRCSL.Count - 1 do
  261.           begin
  262.             { Create a new pointer }
  263.             New( TheNGRecord );
  264.             { Move the data into it }
  265.             TheNGRecord^ :=
  266.              PNewsGroupRecord( TheWorkingNRCSL.Items[ Counter_1 ] )^;
  267.             { Add the item }
  268.             TheNewsRCList.Add( TheNGRecord );
  269.           end;
  270.         end;
  271.     6 : begin { Do EMail Server List }
  272.           { dispose the old server list's pointers }
  273.           for Counter_1 := 0 to TheEMailServerList.Count - 1 do
  274.           begin
  275.             Dispose( PConnectionsRecord( TheEMailServerList.Items[ Counter_1 ] ));
  276.           end;
  277.           { Clear the lists }
  278.           TheEMailServerList.Clear;
  279.           CCInetCCForm.ComboBox1.Clear;
  280.           { Add the new info }
  281.           for Counter_1 := 0 to TheWorkingEMSL.Count - 1 do
  282.           begin
  283.             { Create a new pointer }
  284.             New( ThePointer );
  285.             { Move the data into it }
  286.             ThePointer^ :=
  287.              PConnectionsRecord( TheWorkingEMSL.Items[ Counter_1 ] )^;
  288.             { Add the item }
  289.             TheEMailServerList.Add( ThePointer );
  290.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  291.              TheEMailServerList.Items[ Counter_1 ] )^.CProfile );
  292.           end;
  293.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  294.         end;
  295.   end;
  296.   { Leave }
  297.   Close;
  298. end;
  299.  
  300. { This method cancels any changes made from entries in current setup & exits}
  301. procedure TCCICInfoDlg.BitBtn2Click(Sender: TObject);
  302. var Counter_1  : Integer;            { Loop counter        }
  303.     ThePointer : PConnectionsRecord; { Generic TCR Pointer }
  304.     TheNGRecord : PNewsGroupRecord;
  305.     TheEMMRecord : PEMailMailboxRecord;
  306. begin
  307.   { Use Tag vector do decide what to reset }
  308.   case Tag of
  309.     2 : begin { Reset FTP Site list }
  310.           { Dispose of all the old pointers }
  311.           for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
  312.           begin
  313.             Dispose( PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] ));
  314.           end;
  315.           { Clear the working list }
  316.           TheWorkingFTPSL.Clear;
  317.           { Clear the listbox }
  318.           ListBox2.Clear;
  319.           { Then rebuild the working list and display listbox }
  320.           for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  321.           begin
  322.             { Create the record }
  323.             New( ThePointer );
  324.             { Move data in }
  325.             ThePointer^ :=
  326.              PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] )^;
  327.             { Add the pointer to the list }
  328.             TheWorkingFTPSL.Add( ThePointer );
  329.             { Add the profile name to the list }
  330.             ListBox2.Items.Add( PConnectionsRecord(
  331.              TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  332.           end;
  333.         end;
  334.     4 : begin { Reset NNTP Site list }
  335.           { Dispose of all the old pointers }
  336.           for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
  337.           begin
  338.             Dispose( PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] ));
  339.           end;
  340.           { Clear the working list }
  341.           TheWorkingNSSL.Clear;
  342.           { Clear the listbox }
  343.           ListBox2.Clear;
  344.           { Then rebuild the working list and display listbox }
  345.           for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  346.           begin
  347.             { Create the record }
  348.             New( ThePointer );
  349.             { Move data in }
  350.             ThePointer^ :=
  351.              PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] )^;
  352.             { Add the pointer to the list }
  353.             TheWorkingNSSL.Add( ThePointer );
  354.             { Add the profile name to the list }
  355.             ListBox2.Items.Add( PConnectionsRecord(
  356.              TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  357.           end;
  358.         end;
  359.     5 : begin { Reset NNTP NG list }
  360.           { Dispose of all the old pointers }
  361.           for Counter_1 := 0 to TheWorkingNRCSL.Count - 1 do
  362.           begin
  363.             Dispose( PNewsGroupRecord( TheWorkingNRCSL.Items[ Counter_1 ] ));
  364.           end;
  365.           { Clear the working list }
  366.           TheWorkingNRCSL.Clear;
  367.           { Clear the listbox }
  368.           ListBox2.Clear;
  369.           { Then rebuild the working list and display listbox }
  370.           for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  371.           begin
  372.             { Create the record }
  373.             New( TheNGRecord );
  374.             { Move data in }
  375.             TheNGRecord^ :=
  376.              PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] )^;
  377.             { Add the pointer to the list }
  378.             TheWorkingNRCSL.Add( TheNGRecord );
  379.             { Add the profile name to the list }
  380.             ListBox2.Items.Add( PNewsGroupRecord(
  381.              TheNewsRCList.Items[ Counter_1 ] )^.GName );
  382.           end;
  383.         end;
  384.     6 : begin { Reset FTP Site list }
  385.           { Dispose of all the old pointers }
  386.           for Counter_1 := 0 to TheWorkingEMSL.Count - 1 do
  387.           begin
  388.             Dispose( PConnectionsRecord( TheWorkingEMSL.Items[ Counter_1 ] ));
  389.           end;
  390.           { Clear the working list }
  391.           TheWorkingEMSL.Clear;
  392.           { Clear the listbox }
  393.           ListBox2.Clear;
  394.           { Then rebuild the working list and display listbox }
  395.           for Counter_1 := 0 to TheEMailServerList.Count - 1 do
  396.           begin
  397.             { Create the record }
  398.             New( ThePointer );
  399.             { Move data in }
  400.             ThePointer^ :=
  401.              PConnectionsRecord( TheEMailServerList.Items[ Counter_1 ] )^;
  402.             { Add the pointer to the list }
  403.             TheWorkingEMSL.Add( ThePointer );
  404.             { Add the profile name to the list }
  405.             ListBox2.Items.Add( PConnectionsRecord(
  406.              TheEMailServerList.Items[ Counter_1 ] )^.CProfile );
  407.           end;
  408.         end;
  409.   end;
  410.   { Leave }
  411.   Close;
  412. end;
  413.  
  414. procedure TCCICInfoDlg.Edit4Exit(Sender: TObject);
  415. begin
  416.   { Use tag vector to determine action }
  417.   case Tag of
  418.     2 : begin
  419.           { If Edit4 is modified then mangle pw }
  420.           if Edit4.Modified then
  421.           begin
  422.             { Save pw in either case, but mangle if masked }
  423.             case PasswordControlVector of
  424.               1 : CurrentRealPWString := Edit4.Text;
  425.               2 : begin
  426.                     CurrentRealPWString := Edit4.Text;
  427.                     Edit4.Text := '***********';
  428.                   end;
  429.             end;
  430.           end;
  431.         end;
  432.     6 : begin
  433.           { If Edit4 is modified then mangle pw }
  434.           if Edit4.Modified then
  435.           begin
  436.             { Save pw in either case, but mangle if masked }
  437.             case EMPasswordControlVector of
  438.               1 : CurrentEMRealPWString := Edit4.Text;
  439.               2 : begin
  440.                     CurrentEMRealPWString := Edit4.Text;
  441.                     Edit4.Text := '***********';
  442.                   end;
  443.             end;
  444.           end;
  445.         end;
  446.   end;
  447. end;
  448.  
  449. { Add button; do various add actions }
  450. procedure TCCICInfoDlg.Button2Click(Sender: TObject);
  451. var ThePointer  : PConnectionsRecord; { PCR Pointer }
  452.     TheNGRecord : PNewsGroupRecord;
  453.     TheEMBRecord : PEMailMailboxRecord;
  454.     TempList    : TList;
  455. begin
  456.   { Tag vector control as usual }
  457.   case Tag of
  458.     2 : begin { add new FTP site list entry }
  459.           { Creat new PCR pointer }
  460.           New( ThePointer );
  461.           { Add in the data from the text fields }
  462.           with ThePointer^ do
  463.           begin
  464.             CProfile   := Edit1.Text;
  465.             CIPAddress := Edit2.Text;;
  466.             CUserName  := Edit3.Text;
  467.             { Put in the real pw string }
  468.             CPassword  := CurrentRealPWString;
  469.             CStartDir  := Edit5.Text;
  470.           end;
  471.           { Add pointer to working list }
  472.           TheWorkingFTPSL.Add( ThePointer );
  473.           { Add it to the listbox }
  474.           ListBox2.Items.Add( ThePointer^.CProfile );
  475.           { And set the pointer to it }
  476.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  477.         end;
  478.     4 : begin { add new NNTP site list entry }
  479.           { Creat new PCR pointer }
  480.           New( ThePointer );
  481.           { Add in the data from the text fields }
  482.           with ThePointer^ do
  483.           begin
  484.             CProfile   := Edit1.Text;
  485.             CIPAddress := Edit2.Text;;
  486.             CUserName  := '';
  487.             CPassword  := '';
  488.             CStartDir  := '';
  489.           end;
  490.           { Add pointer to working list }
  491.           TheWorkingNSSL.Add( ThePointer );
  492.           { Add it to the listbox }
  493.           ListBox2.Items.Add( ThePointer^.CProfile );
  494.           { And set the pointer to it }
  495.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  496.         end;
  497.     5 : begin { add new NNTP newsgroup list entry }
  498.           { Creat new PCR pointer }
  499.           New( TheNGRecord );
  500.           TempList := TList.Create;
  501.           { Add in the data from the text fields }
  502.           with TheNGRecord^ do
  503.           begin
  504.             GName     := Edit1.Text;
  505.             GRealName := Edit2.Text;;
  506.             if Edit3.Text = 'UnSubscribed' then GSubscribed := false else
  507.              GSubScribed := true;
  508.             GLowest              := 0;
  509.             GHighest             := 0;
  510.             GTotalNew            := 0;
  511.             GTotalAvailable      := 0;
  512.             GLowestAvailable     := 0;
  513.             GHighestAvailable    := 0;
  514.             GPostable            := true;
  515.             GTotalArticles       := 0;
  516.             GTotalUnReadArticles := 0;
  517.             GIDNumber            := TheWorkingNRCSL.Count + 1;
  518.             GFileName            := 'NL' + IntToStr( WhichServer ) + 'G' +
  519.                                     IntToStr( GIDNumber) + '.NGR';
  520.             GLTag                := Longint( TempList );
  521.           end;
  522.           { Add pointer to working list }
  523.           TheWorkingNRCSL.Add( TheNGRecord );
  524.           { Add it to the listbox }
  525.           ListBox2.Items.Add( TheNGRecord^.GName );
  526.           { And set the pointer to it }
  527.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  528.         end;
  529.     6 : begin { add new EMail server list entry }
  530.           { Creat new PCR pointer }
  531.           New( ThePointer );
  532.           { Add in the data from the text fields }
  533.           with ThePointer^ do
  534.           begin
  535.             CProfile   := Edit1.Text;
  536.             CIPAddress := Edit2.Text;;
  537.             CUserName  := Edit3.Text;
  538.             { Put in the real pw string }
  539.             CPassword  := CurrentEMRealPWString;
  540.             CStartDir  := Edit5.Text;
  541.           end;
  542.           { Add pointer to working list }
  543.           TheWorkingEMSL.Add( ThePointer );
  544.           { Add it to the listbox }
  545.           ListBox2.Items.Add( ThePointer^.CProfile );
  546.           { And set the pointer to it }
  547.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  548.         end;
  549.   end;
  550. end;
  551.  
  552. { This is the modify button }
  553. procedure TCCICInfoDlg.Button3Click(Sender: TObject);
  554. begin
  555.   { Use Tag vector as usual }
  556.   case Tag of
  557.     2 : begin
  558.           { if nothing to modify the exit }
  559.           if ListBox2.ItemIndex = -1 then exit;
  560.           { get record of current listbox pointer & put in data }
  561.           with PConnectionsRecord(
  562.            TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  563.           begin
  564.             CProfile   := Edit1.Text;
  565.             CIPAddress := Edit2.Text;;
  566.             CUserName  := Edit3.Text;
  567.             { Put in the real pw string }
  568.             CPassword  := CurrentRealPWString;
  569.             CStartDir  := Edit5.Text;
  570.           end;
  571.           { Make sure the display matches the edit control }
  572.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  573.         end;
  574.     4 : begin
  575.           { if nothing to modify the exit }
  576.           if ListBox2.ItemIndex = -1 then exit;
  577.           { get record of current listbox pointer & put in data }
  578.           with PConnectionsRecord(
  579.            TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  580.           begin
  581.             CProfile   := Edit1.Text;
  582.             CIPAddress := Edit2.Text;
  583.             CUserName  := '';
  584.             CPassword  := '';
  585.             CStartDir  := '';
  586.           end;
  587.           { Make sure the display matches the edit control }
  588.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  589.         end;
  590.     5 : begin
  591.           { if nothing to modify the exit }
  592.           if ListBox2.ItemIndex = -1 then exit;
  593.           { get record of current listbox pointer & put in data }
  594.           with PNewsGroupRecord(
  595.            TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  596.           begin
  597.             GName     := Edit1.Text;
  598.             GRealName := Edit2.Text;;
  599.             if Edit3.Text = 'UnSubscribed' then GSubscribed := false else
  600.              GSubScribed := true;
  601.           end;
  602.           { Make sure the display matches the edit control }
  603.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  604.         end;
  605.     6 : begin
  606.           { if nothing to modify the exit }
  607.           if ListBox2.ItemIndex = -1 then exit;
  608.           { get record of current listbox pointer & put in data }
  609.           with PConnectionsRecord(
  610.            TheWorkingEMSL.Items[ ListBox2.ItemIndex ] )^ do
  611.           begin
  612.             CProfile   := Edit1.Text;
  613.             CIPAddress := Edit2.Text;;
  614.             CUserName  := Edit3.Text;
  615.             { Put in the real pw string }
  616.             CPassword  := CurrentEMRealPWString;
  617.             CStartDir  := Edit5.Text;
  618.           end;
  619.           { Make sure the display matches the edit control }
  620.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  621.         end;
  622.   end;
  623. end;
  624.  
  625. { This is the delete button }
  626. procedure TCCICInfoDlg.Button4Click(Sender: TObject);
  627. var MessageString : String; { String holder }
  628. begin
  629.   { Use tag control vector }
  630.   case Tag of
  631.     2 : begin
  632.           { If nothing to delete then leave }
  633.           if Listbox2.Itemindex = -1 then exit;
  634.           { Set up display }
  635.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  636.           { Display message box and get result }
  637.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  638.            = mrYes then
  639.           begin
  640.             { if ok delete then remove item from working sl }
  641.             TheWorkingFTPSL.Delete( ListBox2.ItemIndex );
  642.             { delete from listbox }
  643.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  644.             { If nothing left set itemindex and clear edits }
  645.             if ListBox2.Items.Count = 0 then
  646.             begin
  647.               ListBox2.ItemIndex := -1;
  648.               Edit1.Text := '';
  649.               Edit2.Text := '';
  650.               Edit3.Text := '';
  651.               Edit4.Text := '';
  652.               Edit5.Text := '';
  653.             end
  654.             else
  655.             begin
  656.               { Reset listbox pointer }
  657.               ListBox2.ItemIndex  := 0;
  658.               { and reset display to new item }
  659.               with PConnectionsRecord(
  660.                TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  661.               begin
  662.                 Edit1.Text := CProfile;
  663.                 Edit2.Text := CIPAddress;
  664.                 Edit3.Text := CUserName;
  665.                 CurrentRealPWString := CPassword;
  666.                 case PasswordControlVector of
  667.                   1 : Edit4.Text := CPassword;
  668.                   2 : Edit4.Text := '**********';
  669.                 end;
  670.                 Edit5.Text := CStartDir;
  671.               end;
  672.             end;
  673.           end;
  674.         end;
  675.     4 : begin
  676.           { If nothing to delete then leave }
  677.           if Listbox2.Itemindex = -1 then exit;
  678.           { Set up display }
  679.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  680.           { Display message box and get result }
  681.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  682.            = mrYes then
  683.           begin
  684.             { if ok delete then remove item from working sl }
  685.             TheWorkingNSSL.Delete( ListBox2.ItemIndex );
  686.             { delete from listbox }
  687.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  688.             { If nothing left set itemindex and clear edits }
  689.             if ListBox2.Items.Count = 0 then
  690.             begin
  691.               ListBox2.ItemIndex := -1;
  692.               Edit1.Text := '';
  693.               Edit2.Text := '';
  694.               Edit3.Text := '';
  695.               Edit4.Text := '';
  696.               Edit5.Text := '';
  697.             end
  698.             else
  699.             begin
  700.               { Reset listbox pointer }
  701.               ListBox2.ItemIndex  := 0;
  702.               { and reset display to new item }
  703.               with PConnectionsRecord(
  704.                TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  705.               begin
  706.                 Edit1.Text := CProfile;
  707.                 Edit2.Text := CIPAddress;
  708.               end;
  709.             end;
  710.           end;
  711.         end;
  712.     5 : begin
  713.           { If nothing to delete then leave }
  714.           if Listbox2.Itemindex = -1 then exit;
  715.           { Set up display }
  716.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  717.           { Display message box and get result }
  718.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  719.            = mrYes then
  720.           begin
  721.             { if ok delete then remove item from working sl }
  722.             TheWorkingNRCSL.Delete( ListBox2.ItemIndex );
  723.             { delete from listbox }
  724.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  725.             { If nothing left set itemindex and clear edits }
  726.             if ListBox2.Items.Count = 0 then
  727.             begin
  728.               ListBox2.ItemIndex := -1;
  729.               Edit1.Text := '';
  730.               Edit2.Text := '';
  731.               Edit3.Text := '';
  732.               Edit4.Text := '';
  733.               Edit5.Text := '';
  734.             end
  735.             else
  736.             begin
  737.               { Reset listbox pointer }
  738.               ListBox2.ItemIndex  := 0;
  739.               { and reset display to new item }
  740.               with PNewsGroupRecord(
  741.                TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  742.               begin
  743.                 Edit1.Text := GName;
  744.                 Edit2.Text := GRealName;
  745.                 if not GSubscribed then Edit3.Text := 'UnSubscribed' else
  746.                  Edit3.Text := 'SubScribed';
  747.               end;
  748.             end;
  749.           end;
  750.         end;
  751.     6 : begin
  752.           { If nothing to delete then leave }
  753.           if Listbox2.Itemindex = -1 then exit;
  754.           { Set up display }
  755.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  756.           { Display message box and get result }
  757.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  758.            = mrYes then
  759.           begin
  760.             { if ok delete then remove item from working sl }
  761.             TheWorkingEMSL.Delete( ListBox2.ItemIndex );
  762.             { delete from listbox }
  763.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  764.             { If nothing left set itemindex and clear edits }
  765.             if ListBox2.Items.Count = 0 then
  766.             begin
  767.               ListBox2.ItemIndex := -1;
  768.               Edit1.Text := '';
  769.               Edit2.Text := '';
  770.               Edit3.Text := '';
  771.               Edit4.Text := '';
  772.               Edit5.Text := '';
  773.             end
  774.             else
  775.             begin
  776.               { Reset listbox pointer }
  777.               ListBox2.ItemIndex  := 0;
  778.               { and reset display to new item }
  779.               with PConnectionsRecord(
  780.                TheWorkingEMSL.Items[ ListBox2.ItemIndex ] )^ do
  781.               begin
  782.                 Edit1.Text := CProfile;
  783.                 Edit2.Text := CIPAddress;
  784.                 Edit3.Text := CUserName;
  785.                 CurrentEMRealPWString := CPassword;
  786.                 case EMPasswordControlVector of
  787.                   1 : Edit4.Text := CPassword;
  788.                   2 : Edit4.Text := '**********';
  789.                 end;
  790.                 Edit5.Text := CStartDir;
  791.               end;
  792.             end;
  793.           end;
  794.         end;
  795.   end;
  796. end;
  797.  
  798. procedure TCCICInfoDlg.ListBox1DblClick(Sender: TObject);
  799. begin
  800.   case Tag of
  801.     5 : begin
  802.           if ListBox1.ItemIndex <> -1 then
  803.            Edit2.Text := ListBox1.Items[ Listbox1.ItemIndex ];
  804.         end;
  805.   end;
  806. end;
  807.  
  808. end.
  809.